package cn.addr.user.model;

import java.io.Serializable;
import java.util.LinkedHashSet;
import java.util.Set;

@SuppressWarnings("serial")
public class Tag implements Serializable{
	private Long id;
	private String tagname;
	private Set<LinkPerson> persons = new LinkedHashSet<LinkPerson>();
	private UserBean user;
	/**
	 *  id           :long         			 , 可选, 标签id  .
        name         :string(30)   			 , 可选, 标签名          .
        persons   	 :collection 		 	 , 可选, 联系人组      。
        user		 :UserBean				 , 可选, 所属用户     .
	 */
	

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getTagname() {
		return tagname;
	}
	public void setTagname(String tagname) {
		this.tagname = tagname;
	}
	public Set<LinkPerson> getPersons() {
		return persons;
	}
	public void setPersons(Set<LinkPerson> persons) {
		this.persons = persons;
	}
	public UserBean getUser() {
		return user;
	}
	public void setUser(UserBean user) {
		this.user = user;
	}
	public Tag() {
		super();
	}
	
	@Override
	public String toString() {
		return "Tag [id=" + id + ", tagname=" + tagname + ", persons="
				+ persons + ", user=" + user + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((tagname == null) ? 0 : tagname.hashCode());
		result = prime * result + ((user == null) ? 0 : user.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Tag other = (Tag) obj;
		if (tagname == null) {
			if (other.tagname != null)
				return false;
		} else if (!tagname.equals(other.tagname))
			return false;
		if (user == null) {
			if (other.user != null)
				return false;
		} else if (!user.equals(other.user))
			return false;
		return true;
	}
	
	
	
	
	
	
}
